<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>用户列表</h2>
	</div>
	<div class="cf">
		<div class="fl">
            <a class="btn" href="{:U('Admin/Usermember/add')}">新 增</a>
            <button class="btn ajax-post" url="{:U('Usermember/changeStatus',array('method'=>'resumeUser'))}" target-form="ids">启 用</button>
            <button class="btn ajax-post" url="{:U('Usermember/changeStatus',array('method'=>'forbidUser'))}" target-form="ids">禁 用</button>
            <button class="btn ajax-post confirm" id="ids_fore" onClick="foreverdel(0,'/Admin/Usermember');" target-form="ids">删 除</button>
        </div>

        <!-- 高级搜索 -->
		<div class="search-form fr cf">
			<form action="/Admin/Usermember/index" id="form1" method="get">
				<div class="sleft">
					<!--<input type="text" name="typeid" class="search-input" value="" placeholder="文件分类">-->
					<select class="search-input" name="user_type">
						<option value="">请选择分组</option>
						<volist name="userfz" id="typelist">
							<option value="{$typelist.id}" <?php if($_GET['user_type']==$typelist[id]){echo 'selected';} ?>>{$typelist.title}</option>
						</volist>
					</select>
					<select class="search-input" name="check_status">
						<option value="">请选择审核状态</option>
						<option value="wsh" <?php if($_GET['check_status']=='wsh'){echo 'selected';} ?>>未审核</option>
						<option value="1" <?php if($_GET['check_status']==1){echo 'selected';} ?>>审核成功</option>
						<option value="2" <?php if($_GET['check_status']==2){echo 'selected';} ?>>审核失败</option>

					</select>
					<input type="text" name="title" class="search-input" value="{$get[title]}" placeholder="标题">
					<a class="sch-btn" href="javascript:;" id="search" ><i class="btn-search"></i></a>
				</div>
			</form>
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="row-selected row-selected" ><input class="check-all" type="checkbox"/></th>
		<th class="" >编号</th>
		<th class="" >用户名称</th>
		<th class="" >手机号码</th>
		<th class="" >用户身份</th>
		<th class="" >注册时间</th>
			<th class="" >用户城市</th>
			<th class="" >企业联系人</th>
			<th class="" >VIP等级</th>
			<th class="" >VIP到期时间</th>
		<th class="" >余额</th>
		<th class="" >状态</th>
		<th class="" >操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="list">
		<volist name="list" id="vo">
		<tr>
            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
			<td>{$vo.id} </td>
			<td>{$vo.username}</td>
			<td>{$vo.mobile}</td>
			<td><if condition="$vo[user_type] eq 1">个人用户<else/>企业用户</if></td>
			<td>{$vo.create_time|date='Y-m-d',###}</td>
			<td>{$vo.city_id|modelField='city','areaname'}</td>
			<td>{$vo.linkman}</td>
			<td><if condition="$vo[vip_id] gt 0">{$vo.vip_id|modelField='vip','title'}<else/>未开通</if></td>
			<td><if condition="$vo[vip_end_time] gt 0">{$vo.vip_end_time|date='Y-m-d H:i',###}<else/>无</if></td>
			<td><font style="color: red;">￥{$vo.balance}</font></td>
			<td>{$vo.status|get_status_title}</td>
			<td><eq name="vo.status" value="1">
				<a href="{:U('Usermember/changeStatus?method=forbidUser&id='.$vo['id'])}" class="ajax-get">禁用</a>
				<else/>
				<a href="{:U('Usermember/changeStatus?method=resumeUser&id='.$vo['id'])}" class="ajax-get">启用</a>
				</eq>
                <a href="{:U('Usermember/edit?id='.$vo['id'])}">编辑</a>
				<a href="{:U('Usermember/changeStatus?method=deleteuser&id='.$vo['id'])}" class="confirm ajax-get">删除</a>
                <a href="javascript:;" onclick="chongzhi({$vo['id']})">充值</a>
				<if condition="$vo['user_type'] neq 5">
                <a href="javascript:;" onclick="flowwater({$vo['id']})">流水</a>
				</if>
				<a href="{:U('Usermember/set_vip?id='.$vo['id'])}">设置vip</a>
                </td>
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
	<script src="__STATIC__/layer/layer.js"></script>

	<script type="text/javascript">
	//搜索功能
    $("#search").click(function(){
        $("#form1").submit();
    });
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
    //导航高亮
    highlight_subnav('{:U('Usermember/index')}');
    
    //充值
		function chongzhi(id) {
            layer.prompt({title: '输入充值金额', formType: 0}, function(value,index,elem){
                layer.confirm('确定进行充值吗？', {
                    btn: ['确定','取消'] //按钮
                }, function(){
                    $.post("/Admin/Usermember/chongzhi",{id:id,value:value},function (d) {
                        if(d.code==200){
                            layer.msg(d.msg,{time:1000});
                            setTimeout(function () {
								window.location.reload();
                            })
						}else{
                            layer.msg(d.msg);
						}
                    })
                });
            });
        }

        //查看流水
		function flowwater(id) {
            layer.open({
                type: 2,
                title: false,
                shadeClose: true,
                closeBtn: 0, //不显示关闭按钮
                shade: 0.8,
                area : ['600px', '550px'],
                content: ['/Admin/Usermember/flowater?id='+id, 'no']
            });
        }

    
	</script>
</block>
